import 'package:flutter/material.dart';
import 'package:wk_weather/utils/RouterEffect.dart';
import 'package:wk_weather/views/pages/about/AboutPage.dart';
import 'package:wk_weather/views/pages/manager/manager_page.dart';
import 'package:wk_weather/views/pages/search/SearchPage.dart';
import 'package:wk_weather/views/widget/ListItemWidget.dart';


class MyRouter {
  static const String manager = 'manager';
  static const String search = 'search';
  static const String about = 'about';
  static const String weathereffectShow = "list";


  /// RouteFactory = Route<dynamic> Function(RouteSettings settings);  <br>
  /// onGenerateRoute 属性就就是一个函数，所以需要配置一个函数
  static Route<dynamic> generateRoute( RouteSettings settings) {
    switch (settings.name) {

      case search:
        return FadeRouter(  child: SearchPage(), settings: RouteSettings(name: search));

      case manager:
        return FadeRouter( child: ManagerPage(), settings: RouteSettings(name: manager));

      case about:  // 关于
        return FadeRouter(child: AboutPage(), settings: settings);
      // case weathereffectShow:  // 天气效果 列表展示
      //   return FadeRouter(child: WeatherEffectShowView(), settings: settings);

      default:
        return MaterialPageRoute(
            builder: (_) => Scaffold(
              body: Center(
                child: Text('没有找到对应的页面 ${settings.name}'),
              ),
            ));
    }
  }

}